package com.yn.pet.bus.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

@AllArgsConstructor
@Getter
public enum FenceTypeEnum {

    // 圆形围栏，code 对应 1
    CIRCLE(1, "圆形"),
    // 多边形围栏，code 对应 2
    POLYGON(2, "多边形");

    private Integer code;
    private String name;

    public static FenceTypeEnum getByCode(Integer code) {
        if (code == null) {
            return null;
        }
        for (FenceTypeEnum typeEnum : FenceTypeEnum.values()) {
            if (typeEnum.getCode().equals(code)) {
                return typeEnum;
            }
        }
        return null;
    }
}